package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.proxy.RpcProxyFactory;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rpc")
public class RpcClientController {

    @RequestMapping("/demo")
    public User getUser(int id){
        IUserService userService = (IUserService) RpcProxyFactory.createProxy(IUserService.class);
        return userService.getById(id);
    }
}
